Optimal. Leaf size=50 \[ \frac {2 b^2 \cos (c+d x)}{d^3}-\frac {(a+b x)^2 \cos (c+d x)}{d}+\frac {2 b (a+b x) \sin (c+d x)}{d^2} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.03, antiderivative size = 50, normalized size of antiderivative = 1.00, number of steps
used = 3, number of rules used = 2, integrand size = 14, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.143, Rules used = {3377, 2718}
\begin {gather*} \frac {2 b (a+b x) \sin (c+d x)}{d^2}-\frac {(a+b x)^2 \cos (c+d x)}{d}+\frac {2 b^2 \cos (c+d x)}{d^3} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 2718
Rule 3377
Rubi steps
\begin {align*} \int (a+b x)^2 \sin (c+d x) \, dx &=-\frac {(a+b x)^2 \cos (c+d x)}{d}+\frac {(2 b) \int (a+b x) \cos (c+d x) \, dx}{d}\\ &=-\frac {(a+b x)^2 \cos (c+d x)}{d}+\frac {2 b (a+b x) \sin (c+d x)}{d^2}-\frac {\left (2 b^2\right ) \int \sin (c+d x) \, dx}{d^2}\\ &=\frac {2 b^2 \cos (c+d x)}{d^3}-\frac {(a+b x)^2 \cos (c+d x)}{d}+\frac {2 b (a+b x) \sin (c+d x)}{d^2}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.10, size = 57, normalized size = 1.14 \begin {gather*} \frac {-\left (\left (a^2 d^2+2 a b d^2 x+b^2 \left (-2+d^2 x^2\right )\right ) \cos (c+d x)\right )+2 b d (a+b x) \sin (c+d x)}{d^3} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [B] Leaf count of result is larger than twice the leaf count of optimal. \(147\) vs.
\(2(50)=100\).
time = 0.06, size = 148, normalized size = 2.96
method | result | size |
risch | \(-\frac {\left (d^{2} x^{2} b^{2}+2 a b \,d^{2} x +d^{2} a^{2}-2 b^{2}\right ) \cos \left (d x +c \right )}{d^{3}}+\frac {2 b \left (b x +a \right ) \sin \left (d x +c \right )}{d^{2}}\) | \(61\) |
norman | \(\frac {\frac {b^{2} x^{2} \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}-\frac {2 d^{2} a^{2}-4 b^{2}}{d^{3}}-\frac {b^{2} x^{2}}{d}+\frac {4 b^{2} x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d^{2}}+\frac {4 a b \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d^{2}}-\frac {2 a b x}{d}+\frac {2 a b x \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}}{1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )}\) | \(130\) |
derivativedivides | \(\frac {-a^{2} \cos \left (d x +c \right )+\frac {2 a b c \cos \left (d x +c \right )}{d}+\frac {2 a b \left (\sin \left (d x +c \right )-\left (d x +c \right ) \cos \left (d x +c \right )\right )}{d}-\frac {b^{2} c^{2} \cos \left (d x +c \right )}{d^{2}}-\frac {2 b^{2} c \left (\sin \left (d x +c \right )-\left (d x +c \right ) \cos \left (d x +c \right )\right )}{d^{2}}+\frac {b^{2} \left (-\left (d x +c \right )^{2} \cos \left (d x +c \right )+2 \cos \left (d x +c \right )+2 \left (d x +c \right ) \sin \left (d x +c \right )\right )}{d^{2}}}{d}\) | \(148\) |
default | \(\frac {-a^{2} \cos \left (d x +c \right )+\frac {2 a b c \cos \left (d x +c \right )}{d}+\frac {2 a b \left (\sin \left (d x +c \right )-\left (d x +c \right ) \cos \left (d x +c \right )\right )}{d}-\frac {b^{2} c^{2} \cos \left (d x +c \right )}{d^{2}}-\frac {2 b^{2} c \left (\sin \left (d x +c \right )-\left (d x +c \right ) \cos \left (d x +c \right )\right )}{d^{2}}+\frac {b^{2} \left (-\left (d x +c \right )^{2} \cos \left (d x +c \right )+2 \cos \left (d x +c \right )+2 \left (d x +c \right ) \sin \left (d x +c \right )\right )}{d^{2}}}{d}\) | \(148\) |
meijerg | \(\frac {4 b^{2} \sqrt {\pi }\, \sin \left (c \right ) \left (\frac {x \left (d^{2}\right )^{\frac {3}{2}} \cos \left (d x \right )}{2 \sqrt {\pi }\, d^{2}}-\frac {\left (d^{2}\right )^{\frac {3}{2}} \left (-\frac {3 d^{2} x^{2}}{2}+3\right ) \sin \left (d x \right )}{6 \sqrt {\pi }\, d^{3}}\right )}{d^{2} \sqrt {d^{2}}}+\frac {4 b^{2} \sqrt {\pi }\, \cos \left (c \right ) \left (-\frac {1}{2 \sqrt {\pi }}+\frac {\left (-\frac {d^{2} x^{2}}{2}+1\right ) \cos \left (d x \right )}{2 \sqrt {\pi }}+\frac {d x \sin \left (d x \right )}{2 \sqrt {\pi }}\right )}{d^{3}}+\frac {4 b a \sqrt {\pi }\, \sin \left (c \right ) \left (-\frac {1}{2 \sqrt {\pi }}+\frac {\cos \left (d x \right )}{2 \sqrt {\pi }}+\frac {d x \sin \left (d x \right )}{2 \sqrt {\pi }}\right )}{d^{2}}+\frac {4 b a \sqrt {\pi }\, \cos \left (c \right ) \left (-\frac {d x \cos \left (d x \right )}{2 \sqrt {\pi }}+\frac {\sin \left (d x \right )}{2 \sqrt {\pi }}\right )}{d^{2}}+\frac {a^{2} \sin \left (c \right ) \sin \left (d x \right )}{d}+\frac {a^{2} \sqrt {\pi }\, \cos \left (c \right ) \left (\frac {1}{\sqrt {\pi }}-\frac {\cos \left (d x \right )}{\sqrt {\pi }}\right )}{d}\) | \(224\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [B] Leaf count of result is larger than twice the leaf count of optimal. 141 vs.
\(2 (50) = 100\).
time = 0.33, size = 141, normalized size = 2.82 \begin {gather*} -\frac {a^{2} \cos \left (d x + c\right ) + \frac {b^{2} c^{2} \cos \left (d x + c\right )}{d^{2}} - \frac {2 \, a b c \cos \left (d x + c\right )}{d} - \frac {2 \, {\left ({\left (d x + c\right )} \cos \left (d x + c\right ) - \sin \left (d x + c\right )\right )} b^{2} c}{d^{2}} + \frac {2 \, {\left ({\left (d x + c\right )} \cos \left (d x + c\right ) - \sin \left (d x + c\right )\right )} a b}{d} + \frac {{\left ({\left ({\left (d x + c\right )}^{2} - 2\right )} \cos \left (d x + c\right ) - 2 \, {\left (d x + c\right )} \sin \left (d x + c\right )\right )} b^{2}}{d^{2}}}{d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 0.35, size = 63, normalized size = 1.26 \begin {gather*} -\frac {{\left (b^{2} d^{2} x^{2} + 2 \, a b d^{2} x + a^{2} d^{2} - 2 \, b^{2}\right )} \cos \left (d x + c\right ) - 2 \, {\left (b^{2} d x + a b d\right )} \sin \left (d x + c\right )}{d^{3}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 112 vs.
\(2 (48) = 96\).
time = 0.14, size = 112, normalized size = 2.24 \begin {gather*} \begin {cases} - \frac {a^{2} \cos {\left (c + d x \right )}}{d} - \frac {2 a b x \cos {\left (c + d x \right )}}{d} + \frac {2 a b \sin {\left (c + d x \right )}}{d^{2}} - \frac {b^{2} x^{2} \cos {\left (c + d x \right )}}{d} + \frac {2 b^{2} x \sin {\left (c + d x \right )}}{d^{2}} + \frac {2 b^{2} \cos {\left (c + d x \right )}}{d^{3}} & \text {for}\: d \neq 0 \\\left (a^{2} x + a b x^{2} + \frac {b^{2} x^{3}}{3}\right ) \sin {\left (c \right )} & \text {otherwise} \end {cases} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 5.15, size = 65, normalized size = 1.30 \begin {gather*} -\frac {{\left (b^{2} d^{2} x^{2} + 2 \, a b d^{2} x + a^{2} d^{2} - 2 \, b^{2}\right )} \cos \left (d x + c\right )}{d^{3}} + \frac {2 \, {\left (b^{2} d x + a b d\right )} \sin \left (d x + c\right )}{d^{3}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 4.70, size = 84, normalized size = 1.68 \begin {gather*} \frac {\cos \left (c+d\,x\right )\,\left (2\,b^2-a^2\,d^2\right )}{d^3}-\frac {b^2\,x^2\,\cos \left (c+d\,x\right )}{d}+\frac {2\,a\,b\,\sin \left (c+d\,x\right )}{d^2}+\frac {2\,b^2\,x\,\sin \left (c+d\,x\right )}{d^2}-\frac {2\,a\,b\,x\,\cos \left (c+d\,x\right )}{d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________